#!/bin/bash

# Ensure the script is executed in this directory
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $DIR

set -ex

pwdstring=`pwd`
prefLocation=$WM_PROJECT_DIR/etc/prefs.sh

if [ -z "$FOAM_USER_SRC" ]; then
    echo "Creating FOAM_USER_SRC before compiling in $prefLocation"
    echo "# Setting up environment variable for FOAM-FSI" >> $prefLocation
    echo "export FOAM_USER_SRC=$pwdstring/src" >> $prefLocation
fi

source $FOAM_SRC/../etc/bashrc

cd src/thirdParty
./Allmake
cd ../../

./Allwmake
